<template>
  <main>
    <el-button @click="open()"> OPEN </el-button> 
    <el-input
    v-model="host"
    autosize
    type="textarea"
    placeholder="Please input"
  />
    <el-button @click="save()"> save </el-button> 
  </main>
</template>

<script>
import service from "../../common/api.js";
var res;
export default {
  data() {
    return {
      host:'',
    };
  }, 

  created() {
    Object.assign(this, { service }); 
    this.get()
  }, 
  methods:{ 
    async open(){
      res = await service.post("/host/api/open",{}) 
    },
    async get(){ 
      res = await service.post("/host/api/host",{}) 
      console.log(res)
      this.host = res.host
    },
    async save(){ 
      res = await service.post("/host/api/host",{host:this.host})  
      console.log(res)
    },
  },

};
</script>

<style scoped></style>
